#include <iostream>
#include <cmath>
#include <limits.h>  //INT_MAX
using namespace std;

bool IsPrime(int n)  // 素数判断
{
    for(int i = 2; i <= sqrt(n); ++i){
        if(n % i == 0){
            return false;
        }
    }
    return true;
}

int main()
{
    int even;
    cin >> even;
    if(even < 4 || even > 1000 || even & 1)  //不在 [4,1000]，或为奇数
        return 0;
    
    int num1 = 0,  num2 = 0;
    int dif = INT_MAX;   //最小差值
    for(int i = 1, j = even - 1; i <= even/2, j >= even/2; ++i, --j){
        if(IsPrime(i) && IsPrime(j)){  //是素数
            if(j-i < dif){
                dif = j - i;
                num1 = i, num2 = j;
            }
        }
    }
    cout << num1 << endl << num2 << endl;
    return 0;
}